package com.ruoyi.pingjiao.utils;

import com.ruoyi.pingjiao.domain.Coureassess;
import com.ruoyi.pingjiao.service.CourseAssessService;
import com.ruoyi.pingjiao.service.ITeacherService;
import lombok.extern.slf4j.Slf4j;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringRunner;

import javax.annotation.Resource;
import java.util.*;

@SpringBootTest
public class TestUtils {
    @Autowired
    private ITeacherService teacherService;
    @Autowired
    private  CourseAssessService courseAssessService;
    @Test
    public  void test(){
//        //获取模板
//        String path="D:\\workspace\\wordTset\\src\\main\\resources\\doc\\test1.docx";
//
//        XWPFTemplate template = XWPFTemplate.compile(path);  // 读取模板内容
//        Map<String,Object> map = new HashMap<>();
//        Teacher teacher =teacherService.selectTeacherWithCourseByTeacherId(1L);
//        map.put("title1","《JavaEE开发框架》");
//        map.put("course",teacher);
        List<Coureassess> programs = courseAssessService.list(1);
        Object[] objects = programs.toArray();
        System.out.println(objects);
//        XWPFDocument document=new XWPFDocument();
//        XWPFTable table = document.createTable(programs.size(), 3);
//        // 设置表格宽度
//        CTTblWidth width = table.getCTTbl().addNewTblPr().addNewTblW();
//        width.setType(STTblWidth.DXA);
//        width.setW(BigInteger.valueOf(5000));
//        for(int i=0;i<programs.size();i++){
//            for (int j=0;j<3;j++){
//                XWPFTableCell cell = table.getRow(i).getCell(j);
//                cell.setText();
//            }
//        }
//        RowRenderData rowRenderData0 = Rows.of("课程目标", "支持毕业要求目标点", "对应的毕业要求").create();
//        RowRenderData rowRenderData1 = Rows.of(programs.get(0).getCourseassess(),programs.get(0).getRequirePort(),programs.get(0).getRequireType()).create();
//        RowRenderData rowRenderData2 = Rows.of(programs.get(1).getCourseassess(),programs.get(1).getRequirePort(),programs.get(1).getRequireType()).create();
//        RowRenderData rowRenderData3 = Rows.of(programs.get(2).getCourseassess(),programs.get(2).getRequirePort(),programs.get(2).getRequireType()).create();
//        RowRenderData rowRenderData4 = Rows.of(programs.get(3).getCourseassess(),programs.get(3).getRequirePort(),programs.get(3).getRequireType()).create();
//        TableRenderData tableRenderData1 = Tables.create(rowRenderData0, rowRenderData1, rowRenderData2, rowRenderData3, rowRenderData4);
//        map.put("table2",table);
//
//        map.put("cj","60%");
//        map.put("cj_context","上机作业、总结报告");
//        map.put("ks","40%");
//        map.put("ks_context","期末大作业");
//
//        map.put("p",programs.get(0));
//        map.put("p1",programs.get(1));
//        map.put("p2",programs.get(2));
//        map.put("p3",programs.get(3));




//        List<PMDto> list=pingjiaMapper.getbymId(1);
//        PMDto l1pmDto = list.get(0);
//        PMDto l1pmDto1 = list.get(1);
//        PMDto l1pmDto2= list.get(2);
//        map.put("l1pd",l1pmDto);
//        map.put("l1pd1",l1pmDto1);
//        map.put("l1pd2",l1pmDto2);
//        List<PMDto> list2=pingjiaMapper.getbymId(2);
//        PMDto l2pmDto = list2.get(0);
//        PMDto l2pmDto1 = list2.get(1);
//        map.put("l2pd",l2pmDto);
//        map.put("l2pd1",l2pmDto1);
//        List<PMDto> list3=pingjiaMapper.ge
    }

}
